#include <string>
#include <iostream>

#include <protocol/TBinaryProtocol.h>
#include <transport/TSocket.h>
#include <transport/TTransportUtils.h>

#include "Hello.h"

using namespace std;

using namespace apache::thrift;
using namespace apache::thrift::protocol;
using namespace apache::thrift::transport;

using namespace boost;

const int PORT = 9090;
int main(int argc, char* argv[])
{
	shared_ptr<TTransport> socket(new TSocket("localhost", PORT));
	shared_ptr<TTransport> transport(new TBufferedTransport(socket));
	shared_ptr<TProtocol> protocol(new TBinaryProtocol(transport));

	HelloClient client(protocol);	
	try 
	{
		transport->open();
		string input = "world";
		string result;
		client.say(result, input);
		cout << result << endl;
		transport->close();
	}
	catch(TException& ex)
	{
		cout << "Exception:" << ex.what() << endl;
	}

	return 0;
}
